package cn.edu.scau.cmi.luodongmei.composite.component;

import java.util.ArrayList;

public class Composite extends WorldOrganization{
	private ArrayList<WorldOrganization> countryList;
	private String saying = "";
	
	public Composite() {
		countryList = new ArrayList<WorldOrganization>();
	}
	
	@Override
	public String say() {
		for(int i=0; i<countryList.size(); i++) {
			WorldOrganization ctry = countryList.get(i);
			saying = saying + ctry.say() + "\n";
		}
		return saying;
	}

	@Override
	public void add(WorldOrganization c) {
		if(c != null)
			countryList.add(c);
	}

	@Override
	public void remove(WorldOrganization c) {
		if(c != null) 
			countryList.remove(c);
	}
	
}
